<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    .layout:not(:nth-of-type(1)) {
      margin-top: 50px;
    }

    .layout article div {
      min-height: 100px;
    }

    .layout article .left, 
    .layout article .right {
      width: 300px;
    }

    .layout article .left {
      background: #bfa;
    }

    .layout article .right{
      background: #bbf;
    }

    .layout article .center{
      background: #ff0;
    }
  </style>
</head>
<body>
  <section class="layout float">
    <style>
      .float .left {
        float: left;
      }

      .float .right {
        float: right;
      }
    </style>
    <article>
      <div class="left"></div>
      <div class="right"></div>
      <div class="center">
        <h1>float 解决方案</h1>
        <p>浮动布局文字自动排版到左边了。（浮动的基本原理）</p>
        <p>浮动布局文字自动排版到左边了。（浮动的基本原理）</p>
        <p>浮动布局文字自动排版到左边了。（浮动的基本原理）</p>
        <p>浮动布局文字自动排版到左边了。（浮动的基本原理）</p>
        <p>浮动布局文字自动排版到左边了。（浮动的基本原理）</p>
        <p>浮动布局文字自动排版到左边了。（浮动的基本原理）</p>
      </div>
    </article>
  </section>
  <section class="layout absolute">
    <style>
      .absolute article {
        position: relative;
        height: 100px;
      }

      .absolute .left {
        position: absolute;
        left: 0;
      }

      .absolute .right {
        position: absolute;
        right: 0;
      }

      .absolute .center {
        position: absolute;
        left: 300px;
        right: 300px;
      }
    </style>
    <article>
      <div class="left"></div>
      <div class="center">
        <h1>absolute 解决方案</h1>
        <p>绝对布局只撑开中间部分</p>
        <p>绝对布局只撑开中间部分</p>
        <p>绝对布局只撑开中间部分</p>
        <p>绝对布局只撑开中间部分</p>
        <p>绝对布局只撑开中间部分</p>
      </div>
      <div class="right"></div>
    </article>
  </section>
  <section class="layout flex">
    <style>
      .layout.flex article {
        display: flex;
      }

      .layout.flex .center{
        flex: 1;
      }
    </style>
    <article>
      <div class="left"></div>
      <div class="center">
        <h1>flex 解决方案</h1>
        <p>flex 布局最好～</p>
        <p>flex 布局最好～</p>
        <p>flex 布局最好～</p>
        <p>flex 布局最好～</p>
        <p>flex 布局最好～</p>
        <p>flex 布局最好～</p>
        <p>flex 布局最好～</p>
      </div>
      <div class="right"></div>
    </article>
  </section>
  <section class="layout">
  </section>
</body>
</html>